var INTER_FLAG = '3'; //接口类型，若为'1'则表示新接口，新接口必需有商户公钥的前30位PUB32
//接口类型，若为'1'则表示新接口，新接口必需有商户公钥的前30位PUB32
var MERCHANTID = ''; //UAT--可用防钓鱼接口
var POSID = ''; //分行代码
var BRANCHID = '';

var ORDERID = ''; //'001';

var PAYMENT = '';
var CURCODE = '01';
var TXCODE = '530590';
var OPERID = '';
var AUTHID = '';
var PASSWORD = '';
var REQUESTSN = '';
var REMARK1 = '';
var REMARK2 = '';
var PUB32 = '';
var INSTALLNUM = '';

var CCBCLIENT = '';

/***二级商户支付***/
var SMERID = '';
var SMERNAME = '';
var SMERTYPEID = '';
var SMERTYPE = '';
var TRADECODE = '';
var TRADENAME = '';
var PROTYPE = '';
var PRONAME = '';

var ISSINSCODE = '';
var THIRDAPPINFO = '';
var TIMEOUT = '';
var NoCredit = ''; //	不允许信用卡
var NoDebit = ''; //	不允许借记卡
var USERNAME = ''; //	客户姓名
var IDNUMBER = ''; //	客户证件号码
var USERPARAM = ''; //客户加密信息
var FZINFO1 = '';
var FZINFO2 = '';




//以下内容不要轻易改动
var strMD5;
var URL;
var URL0; //网上银行支付
var URL1; //E付卡支付


var MERCHANTID = "105009558126957";
var POSID = "081041485";
var BRANCHID = "350000000";
var CURCODE = "01";
var TXCODE = "530590";
var TRADE_TYPE = "MINIPRO";
var PUB = "8109f01232d92b6e3798a069020111";
var GATEWAY = "0";
var CLIENTIP = "120.78.130.16";
var SUB_APPID = "wx4f63e2e145ce61ff";
var SUB_OPENID = '';

function make(ORDERID, PAYMENT, REMARK1, REMARK2,REGINFO, PROINFO, REFERER, TIMEOUT, SUB_OPENID) {
	var tmp;
	var tmp0;
	var tmp1;
	var temp_New1;
	var temp_New;

	tmp = 'MERCHANTID=' + MERCHANTID + '&POSID=' + POSID + '&BRANCHID=' + BRANCHID + '&ORDERID=' + ORDERID +
		'&PAYMENT=' + PAYMENT + '&CURCODE=' + CURCODE + '&TXCODE=' + TXCODE + '&REMARK1=' + REMARK1 + '&REMARK2=' +
		REMARK2;
	tmp0 = 'MERCHANTID=' + MERCHANTID + '&POSID=' + POSID + '&BRANCHID=' + BRANCHID + '&ORDERID=' + ORDERID +
		'&PAYMENT=' + PAYMENT + '&CURCODE=' + CURCODE + '&TXCODE=520100' + '&REMARK1=' + REMARK1 + '&REMARK2=' +
		REMARK2;

	var index = 3;
	temp_New = tmp;

	if (index == "3") {
		temp_New = tmp + '&TYPE=1&PUB=' + PUB + '&GATEWAY=' + GATEWAY + '&CLIENTIP=' + CLIENTIP + '&REGINFO=' +
			escape(REGINFO) + '&PROINFO=' + escape(PROINFO) + '&REFERER=' + REFERER;
		temp_New1 = tmp + '&TYPE=1&GATEWAY=' + GATEWAY + '&CLIENTIP=' + CLIENTIP + '&REGINFO=' + escape(REGINFO) +
			'&PROINFO=' + escape(PROINFO) + '&REFERER=' + REFERER;
		if (INSTALLNUM != "") {
			temp_New = temp_New + '&INSTALLNUM=' + INSTALLNUM;
			temp_New1 = temp_New1 + '&INSTALLNUM=' + INSTALLNUM;
		}
		if (SMERID != "") {
			temp_New = temp_New + '&SMERID=' + SMERID + '&SMERNAME=' + escape(SMERNAME) + '&SMERTYPEID=' + SMERTYPEID +
				'&SMERTYPE=' + escape(SMERTYPE) + '&TRADECODE=' + TRADECODE + '&TRADENAME=' + escape(TRADENAME) +
				'&SMEPROTYPE=' + PROTYPE + '&PRONAME=' + escape(PRONAME);
			temp_New1 = temp_New1 + '&SMERID=' + SMERID + '&SMERNAME=' + escape(SMERNAME) + '&SMERTYPEID=' +
				SMERTYPEID + '&SMERTYPE=' + escape(SMERTYPE) + '&TRADECODE=' + TRADECODE + '&TRADENAME=' + escape(TRADENAME) + '&SMEPROTYPE=' + PROTYPE + '&PRONAME=' + escape(PRONAME);
		}
		if (THIRDAPPINFO != "") {
			temp_New = temp_New + '&THIRDAPPINFO=' + THIRDAPPINFO;
			temp_New1 = temp_New1 + '&THIRDAPPINFO=' + encodeURIComponent(THIRDAPPINFO);
		}
		if (TIMEOUT != "") {
			temp_New = temp_New + '&TIMEOUT=' + TIMEOUT;
			temp_New1 = temp_New1 + '&TIMEOUT=' + TIMEOUT;
		}

		if (ISSINSCODE != "") {
			temp_New = temp_New + '&ISSINSCODE=' + ISSINSCODE;
			temp_New1 = temp_New1 + '&ISSINSCODE=' + ISSINSCODE;
		}
		if (NoCredit != "") {
			temp_New = temp_New + '&NoCredit=' + NoCredit;
			temp_New1 = temp_New1 + '&NoCredit=' + NoCredit;
		}
		if (NoDebit != "") {
			temp_New = temp_New + '&NoDebit=' + NoDebit;
			temp_New1 = temp_New1 + '&NoDebit=' + NoDebit;
		}
		/*
		if(USERNAME != "" && IDNUMBER != ""){
			temp_New = temp_New +'&USERNAME='+escape(USERNAME);
			temp_New1 = temp_New1 +'&USERNAME='+escape(USERNAME);
			temp_New = temp_New +'&IDNUMBER='+escape(IDNUMBER);
			temp_New1 = temp_New1 +'&IDNUMBER='+escape(IDNUMBER);
		}
		*/
		if (USERPARAM != "") {
			temp_New = temp_New + '&USERPARAM=' + USERPARAM;
			temp_New1 = temp_New1 + '&USERPARAM=' + USERPARAM;
		}
		if (FZINFO1 != "") {
			temp_New = temp_New + '&FZINFO1=' + escape(FZINFO1);
			temp_New1 = temp_New1 + '&FZINFO1=' + escape(FZINFO1);
		}
		if (FZINFO2 != "") {
			temp_New = temp_New + '&FZINFO2=' + escape(FZINFO2);
			temp_New1 = temp_New1 + '&FZINFO2=' + escape(FZINFO2);
		}
		if (TRADE_TYPE != "") {
			temp_New = temp_New + '&TRADE_TYPE=' + escape(TRADE_TYPE);
			temp_New1 = temp_New1 + '&TRADE_TYPE=' + escape(TRADE_TYPE);
		}
		if (SUB_APPID != "") {
			temp_New = temp_New + '&SUB_APPID=' + escape(SUB_APPID);
			temp_New1 = temp_New1 + '&SUB_APPID=' + escape(SUB_APPID);
		}
		if (SUB_OPENID != "") {
			temp_New = temp_New + '&SUB_OPENID=' + escape(SUB_OPENID);
			temp_New1 = temp_New1 + '&SUB_OPENID=' + escape(SUB_OPENID);
		}


	}
	// strMD5 = hex_md5(temp_New);
	return temp_New;




}

module.exports = {
  make:make
}
